Skip to content

Codama IDL generation#198

Merged
grod220 merged 5 commits intomainfrom
codama-ixs
Mar 6, 2026
Merged

Codama IDL generation#198
grod220 merged 5 commits intomainfrom
codama-ixs

Conversation

@grod220
Copy link
Member

@grod220 grod220 commented Mar 4, 2026

Added a codama pipeline for the pinocchio ATA crates to generate an IDL. Clients still generated externally in token program.

Note: does not modify the original non-pinocchio crates

Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a conceptual point of view, do we need associated token account clients at all? The legacy and generated JS packages for token bundle the ATA instructions, and the token client does ATA stuff too

@grod220
Copy link
Member Author

grod220 commented Mar 5, 2026

The legacy and generated JS packages for token bundle the ATA instructions, and the token client does ATA stuff too

Ah, didn't realize it's handled independently over there! Sounds better to align on those clients.

Also noticed that there's even an IDL in the token program repo. Not quite sure how that was made, but think there's an argument that the codama-macros in p-ata should generate the canonical IDL. It also ensures it's up-to-date. Then external programs can consume it and generate the clients. What do you think?

@grod220 grod220 requested a review from joncinque March 5, 2026 07:00
Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to generate the IDL! A couple more comments

Copy link
Member

@lorisleiva lorisleiva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a conceptual point of view, do we need associated token account clients at all?

Hmm that's a good question. This definitely needs its own IDL because in the future it would be nice to have Codama auto-load linked program items (such as an ATA PDA) using the Program Metadata program. But as far as having clients, as you said we currently inline that content on token programs which is more practical for devs so probably not worth the overhead of maintaining yet another set of libraries.

@grod220 grod220 changed the title Codama IDL + clients generation Codama IDL generation Mar 5, 2026
@grod220 grod220 requested review from joncinque and lorisleiva March 5, 2026 18:32
Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but do get @lorisleiva 's approval too

@echo "No JavaScript clients to generate"

generate-idl-%:
@cargo install --locked --version =0.7.3 codama-cli
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: for the future, rather than installing in the makefile target, it would be better for the generic action to install required tooling -- for example, the spellcheck job installs cargo-spellcheck and the audit job installs cargo-audit: https://github.com/solana-program/actions/blob/cf2614dd80f3646bc730ea75be989e4ed61383ae/.github/workflows/main.yml#L150

However, maybe we should expect the codama-cli to change a lot over the next year or two. When we feel that it's "stable", then we can add the installation in the generic action

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why not set codama-cli as a dev dependency on the workspace?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, Rust doesn't really have a mechanism for bins at the workspace level, similar to the pnpm <BIN> commands in JS. You install the bin for the user using cargo install and that's it.

(Or you use something like a nix shell, but that's a topic for another day 😁 )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, maybe we should expect the codama-cli to change a lot over the next year or two. When we feel that it's "stable", then we can add the installation in the generic action

Makes sense! Though, if we shipped and used tagged versions of solana-program/actions, breaking changes in those jobs wouldn't affect consumers. May be worth revisiting later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can do that if you promise to do all the downstream repo upgrades for every bump 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱

Copy link
Member

@lorisleiva lorisleiva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me too!

@grod220 grod220 merged commit ef36b0b into main Mar 6, 2026
27 checks passed
@grod220 grod220 deleted the codama-ixs branch March 6, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants